import {defineConfig, loadEnv} from 'vite';

export default defineConfig(({commond, mode}) => {
  // process.cwd()返回NODE进程的工作目录，即NODE项目的根目录
  const env = loadEnv(mode, process.cwd());
  console.log(env);
  
  /**
   * npm run dev
   *  {
   *    VITE_NAME: '开发忽略',
   *    VITE_DEVELOPMENT_LOCAL: 'development.local'
   *    VITE_DEVELOPMENT: 'development',
   *    VITE_ENV_LOCAL: 'env.local',
   *    VITE_ENV: 'env',
   *  }
   */
  
  /**
   * npm run dev-test
   *  {
   *    VITE_NAME: '自定义',
   *    VITE_TEST: 'test'
   *    VITE_ENV_LOCAL: 'env.local',
   *    VITE_ENV: 'env',
   *  }
   */
  
  return {};
});